package cn.lh.service.impl;

import cn.lh.service.AirConConfig;

import java.util.ServiceLoader;

/**
 * @描述:
 * @版权: Copyright (c) 2022
 * @作者: linhong
 * @版本: 1.0.0
 * @创建时间: 2023/5/18
 */
public class AirconditionApp {

    public static void main(String[] args) {
        new AirconditionApp().turnOn("VerticalType");
    }

    public void turnOn(String type){
        ServiceLoader<AirConConfig> load = ServiceLoader
                .load(AirConConfig.class);

        for (AirConConfig iAircondition : load) {
            System.out.println("检测到:"+iAircondition.getClass().getSimpleName());
            if (type.equals(iAircondition.getType())){
                iAircondition.turnOnOff();
            }
        }
    }

}
